package com.ruoyi.cost.service.impl;

import java.util.List;

import com.ruoyi.door.domain.HouseDoorT;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.cost.mapper.HouseDoorCostMapper;
import com.ruoyi.cost.domain.HouseDoorCost;
import com.ruoyi.cost.service.IHouseDoorCostService;
import org.springframework.transaction.annotation.Transactional;

/**
 * 户资金修改Service业务层处理
 *
 * @author ruoyi
 * @date 2023-04-26
 */
@Service
public class HouseDoorCostServiceImpl implements IHouseDoorCostService
{
    @Autowired
    private HouseDoorCostMapper houseDoorCostMapper;

    /**
     * 查询户管理
     *
     * @param doorId 户管理主键
     * @return 户管理
     */
    @Override
    public HouseDoorT selectHouseDoorCostTByDoorId(Long doorId) {
        return houseDoorCostMapper.selectHouseDoorCostTByDoorId(doorId);
    }

    /**
     * 查询户管理列表
     *
     * @param houseDoorT 户管理
     * @return 户管理
     */
    @Override
    public List<HouseDoorT> selectHouseDoorTList(HouseDoorT houseDoorT) {
        return houseDoorCostMapper.selectHouseDoorTList(houseDoorT);
    }

    @Override
    public List<HouseDoorT> selectHouseCostTList(HouseDoorT houseDoorT) {
        return houseDoorCostMapper.selectHouseCostTList(houseDoorT);
    }

    @Override
    public List<HouseDoorT> selectHouseCostTList1(HouseDoorT houseDoorT) {
        return houseDoorCostMapper.selectHouseCostTList1(houseDoorT);
    }

    @Override
    public HouseDoorT selectHouseCostSum(HouseDoorT houseDoorT) {
        return houseDoorCostMapper.selectHouseCostSum(houseDoorT);
    }

    @Override
    public HouseDoorT selectRepairPayMoneySum(HouseDoorT houseDoorT) {
        return houseDoorCostMapper.selectRepairPayMoneySum(houseDoorT);
    }

    @Override
    public HouseDoorT selectRateMoneySum(HouseDoorT houseDoorT) {
        return houseDoorCostMapper.selectRateMoneySum(houseDoorT);
    }

    @Override
    public HouseDoorT selectCostMoneySum(HouseDoorT houseDoorT) {
        return houseDoorCostMapper.selectCostMoneySum(houseDoorT);
    }

    @Override
    public HouseDoorT selectHouseDoorCostTByCostId(HouseDoorT houseDoorT) {
        return houseDoorCostMapper.selectHouseDoorCostTByCostId(houseDoorT);
    }

    @Override
    public HouseDoorT selectRefundMoneySum(HouseDoorT houseDoorT) {
        return houseDoorCostMapper.selectRefundMoneySum(houseDoorT);
    }

    @Override
    public HouseDoorT selectReturnMoneySum(HouseDoorT houseDoorT) {
        return houseDoorCostMapper.selectReturnMoneySum(houseDoorT);
    }

    @Override
    public HouseDoorT selectHouseDoorCostTByHouseId(String houseId) {
        return houseDoorCostMapper.selectHouseDoorCostTByHouseId(houseId);
    }

    @Override
    public HouseDoorT selectHouseDoorCostTByHouseIdMax(String houseId) {
        return houseDoorCostMapper.selectHouseDoorCostTByHouseIdMax(houseId);
    }

    /**
     * 修改户管理
     *
     * @param houseDoorT 户管理
     * @return 结果
     */
    @Transactional
    @Override
    public int updateHouseDoorT(HouseDoorT houseDoorT)
    {
        HouseDoorCost houseDoorCostT = new HouseDoorCost();
        houseDoorCostT.setCostMoneyPre(houseDoorT.getCostMoneyPre());
        houseDoorCostT.setCostDatePre(houseDoorT.getCostDatePre());
        houseDoorCostT.setBalancePre(houseDoorT.getBalancePre());
        houseDoorCostT.setCreater(houseDoorT.getCreater());
        houseDoorCostT.setBillNo(houseDoorT.getBillNo());
        houseDoorCostT.setBillNoPre(houseDoorT.getBillNoPre());
        houseDoorCostT.setRemark(houseDoorT.getRemark());
        houseDoorCostT.setHouseId(houseDoorT.getHouseId());
        houseDoorCostT.setCostMoney(houseDoorT.getCostMoney());
        houseDoorCostT.setCostDate(houseDoorT.getCostDate());
        houseDoorCostT.setBalance(houseDoorT.getBalance());
        houseDoorCostMapper.insertHouseDoorCost(houseDoorCostT);
        HouseDoorT doorTempVO = new HouseDoorT();
        doorTempVO.setCostMoneySum(houseDoorT.getCostMoneySum());
        doorTempVO.setCostDate(houseDoorT.getEndDate());
        doorTempVO.setBalance(houseDoorT.getBalance());
        doorTempVO.setBalanceSum(houseDoorT.getBalanceSum());
        doorTempVO.setHouseId(houseDoorT.getHouseId());
        return houseDoorCostMapper.updateHouseDoorT(doorTempVO);

    }

    @Override
    public int updateHouseCostT(HouseDoorT houseDoorT) {
        return houseDoorCostMapper.updateHouseCostT(houseDoorT);
    }


}
